//
//  MsgPlaySound.m
//  meieshidai
//
//  Created by longziyuan on 14-1-25.
//
//

#import "MsgPlaySound.h"

@implementation MsgPlaySound
-(id)initSystemSoundWithName:(NSString *)soundName SoundType:(NSString *)soundType
{
    if (self=[super init]) {
        NSString* path=[NSString stringWithFormat:@"/System/Library/Audio/UISounds/%@.%@",soundName,soundType];
        if (path) {
            OSStatus error=AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path],&sound);
            if (error!=kAudioServicesNoError) {
                sound=nil;
            }
        }
    }
    return self;
}
-(void)play
{
    AudioServicesPlaySystemSound(sound);
}
@end
